<metroControls:MetroWindow x:Class="LogGrok.Shell.MainWindow"
                           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                           xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"
                           xmlns:be="clr-namespace:LogGrok.Infrastructure.Behaviors;assembly=LogGrok.Infrastructure"
                           xmlns:controls="clr-namespace:LogGrok.Controls;assembly=LogGrok.Controls"
                           xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                           xmlns:infra="clr-namespace:LogGrok.Infrastructure;assembly=LogGrok.Infrastructure"
                           xmlns:interaction="clr-namespace:LogGrok.Infrastructure.Interaction;assembly=LogGrok.Infrastructure"
                           xmlns:interactionRequest="http://www.codeplex.com/prism"
                           xmlns:metroControls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                           xmlns:mui="http://firstfloorsoftware.com/ModernUI"
                           xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism.Composition"
                           xmlns:th="clr-namespace:Xceed.Wpf.AvalonDock.Themes;assembly=Xceed.Wpf.AvalonDock.Themes.Metro"
                           Title="LogGrok"
                           Width="525"
                           Height="350"
                           GlowBrush="{DynamicResource AccentColorBrush}"
                           Icon="pack://application:,,,/LogGrok.Resources;component/whiteeye.ico"
                           SaveWindowPosition="True"
                           ShowTitleBar="True"
                           TextOptions.TextFormattingMode="Display"
                           be:DragnDropBehavior.AllowDrop="True"
                           be:DragnDropBehavior.DropCommand="{Binding DropCommand}">
    <metroControls:MetroWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
                <ResourceDictionary Source="pack://application:,,,/LogGrok.Controls;component/Resources/Icons.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    x:Key="appbar_uservoice"
                    x:Name="appbar_uservoice"
                    Width="76"
                    Height="76"
                    Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
                <Path Canvas.Left="14.25"
                      Canvas.Top="17.4167"
                      Width="44.3333"
                      Height="41.1667"
                      Data="F1 M 49.875,17.4167C 54.6845,17.4167 58.5833,25.9232 58.5833,36.4167C 58.5833,46.9101 54.6845,55.4167 49.875,55.4167C 48.1778,55.4167 46.594,54.3574 45.2549,52.5252C 42.2107,49.2413 39.0479,44.3333 34.8333,44.3333C 31.6667,44.3333 34.4375,47.5 34.4375,50.6667C 34.4375,53.8333 34.8333,58.5833 30.0833,58.5833C 25.3333,58.5833 20.5833,53.8333 22.1667,52.25C 23.75,50.6667 23.75,44.3333 23.75,44.3333C 19,44.3333 14.25,41.1667 14.25,36.4167C 14.25,31.6667 19,26.9167 31.6667,26.9167C 44.3333,26.9167 41.9583,17.4167 49.875,17.4167 Z M 41.1667,36.4167C 41.1667,31.7503 41.9377,27.4768 43.2169,24.1696C 40.8022,26.9173 42.75,28.5 31.8189,30.2356C 21.5881,30.2356 17.7516,32.8846 17.7516,36.7212C 17.7516,40.5577 21.984,41.5321 25.8205,41.5321C 25.8205,41.5321 27.008,50.6058 25.7292,51.8846C 24.4503,53.1635 25.9119,55.0208 29.7484,55.0208C 33.5849,55.0208 30.8902,50.3926 30.8902,47.8349C 30.8902,45.2772 30.0833,41.1667 34.3766,41.1362C 42.75,44.3333 39.9188,43.7895 42.4678,46.4124C 41.6429,43.5087 41.1667,40.084 41.1667,36.4167 Z M 50.6667,20.5833C 48.5363,20.5833 46.7335,25.2581 46.1312,31.698C 50.4667,31.9701 53.8333,33.9789 53.8333,36.4167C 53.8333,38.8544 50.4667,40.8632 46.1312,41.1353C 46.7335,47.5752 48.5363,52.25 50.6667,52.25C 53.29,52.25 55.4167,45.1612 55.4167,36.4167C 55.4167,27.6722 53.29,20.5833 50.6667,20.5833 Z M 49.0833,20.5833C 45.5855,20.5833 42.75,27.6722 42.75,36.4167C 42.75,45.1612 45.5855,52.25 49.0833,52.25L 49.5056,52.2154C 46.6172,51.6722 44.3333,44.8065 44.3333,36.4167C 44.3333,28.0269 46.6172,21.1611 49.5055,20.618L 49.0833,20.5833 Z "
                      Fill="#FF000000"
                      Stretch="Fill" />
            </Canvas>
            <th:MetroTheme x:Key="MetroTheme" />

        </ResourceDictionary>

    </metroControls:MetroWindow.Resources>

    <metroControls:MetroWindow.InputBindings>
        <KeyBinding Command="{Binding OpenFileCommand}" Gesture="CTRL+O" />
        <KeyBinding Command="{Binding OpenFilePartiallyCommand}" Gesture="CTRL+SHIFT+O" />
    </metroControls:MetroWindow.InputBindings>

    <metroControls:MetroWindow.LeftWindowCommands>
        <metroControls:WindowCommands>
            <Menu>
                <MenuItem Header="File">
                    <MenuItem Command="{Binding OpenFileCommand}" Header="Open" />
                    <MenuItem Command="{Binding OpenFilePartiallyCommand}" Header="Open Partially" />
                    <Separator />
                    <MenuItem Command="{Binding ExitCommand}" Header="Exit" />
                </MenuItem>
            </Menu>
        </metroControls:WindowCommands>
    </metroControls:MetroWindow.LeftWindowCommands>
    <metroControls:MetroWindow.RightWindowCommands>
        <metroControls:WindowCommands>
            <Button Command="{Binding ShowScratchPadCommand}">
                <StackPanel Orientation="Horizontal">
                    <Rectangle Width="20"
                               Height="20"
                               Fill="{Binding RelativeSource={RelativeSource AncestorType=Button},
                                              Path=Foreground}">
                        <Rectangle.OpacityMask>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_clipboard_edit}" />
                        </Rectangle.OpacityMask>
                    </Rectangle>
                    <TextBlock Margin="4 0 0 0"
                               VerticalAlignment="Center"
                               Text="scratch pad" />
                </StackPanel>
            </Button>
            <Button Command="{Binding EditColorsCommand}">
                <StackPanel Orientation="Horizontal">
                    <Rectangle Width="20"
                               Height="20"
                               Fill="{Binding RelativeSource={RelativeSource AncestorType=Button},
                                              Path=Foreground}">
                        <Rectangle.OpacityMask>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_settings}" />
                        </Rectangle.OpacityMask>
                    </Rectangle>
                    <TextBlock Margin="4 0 0 0"
                               VerticalAlignment="Center"
                               Text="settings" />
                </StackPanel>
            </Button>
            <Button Command="{Binding ProvideFeedbackCommand}">
                <StackPanel Orientation="Horizontal">
                    <Rectangle Width="20"
                               Height="20"
                               Fill="{Binding RelativeSource={RelativeSource AncestorType=Button},
                                              Path=Foreground}">
                        <Rectangle.OpacityMask>
                            <VisualBrush Stretch="Fill" Visual="{StaticResource appbar_uservoice}" />
                        </Rectangle.OpacityMask>
                    </Rectangle>
                    <TextBlock Margin="4 0 0 0"
                               VerticalAlignment="Center"
                               Text="feedback" />
                </StackPanel>
            </Button>
        </metroControls:WindowCommands>
    </metroControls:MetroWindow.RightWindowCommands>

    <i:Interaction.Triggers>
        <interactionRequest:InteractionRequestTrigger SourceObject="{Binding ShowScratchPadRequest}">
            <interaction:ShowAnchorableLayoutAction DockingManager="{Binding ElementName=DockingManager}">
                <interaction:ShowAnchorableLayoutAction.LayoutAnchorablePane>
                    <avalonDock:LayoutAnchorablePane DockMinHeight="200" />
                </interaction:ShowAnchorableLayoutAction.LayoutAnchorablePane>
                <interaction:ShowAnchorableLayoutAction.LayoutAnchorable>
                    <avalonDock:LayoutAnchorable Title="Scratch Pad">
                        <ContentControl prism:RegionManager.RegionName="ScratchPad" />
                    </avalonDock:LayoutAnchorable>
                </interaction:ShowAnchorableLayoutAction.LayoutAnchorable>
            </interaction:ShowAnchorableLayoutAction>
        </interactionRequest:InteractionRequestTrigger>
        <interactionRequest:InteractionRequestTrigger SourceObject="{Binding MessageRequest}">
            <interaction:MetroMessageBoxeInteractionAction />
        </interactionRequest:InteractionRequestTrigger>
    </i:Interaction.Triggers>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <avalonDock:DockingManager x:Name="DockingManager"
                                   Grid.Row="1"
                                   Theme="{StaticResource MetroTheme}"
                                   be:DocumentCollectionBindingBehavior.CurrentDocument="{Binding CurrentDocument}"
                                   be:DocumentCollectionBindingBehavior.DocumentViewTemplateSelector="{Binding DocumentTemplateSelector}"
                                   be:DocumentCollectionBindingBehavior.DocumentsSource="{Binding Documents}"
                                   be:DocumentCollectionBindingBehavior.OnDocumentCloseCommand="{Binding CloseDocument}">
            <avalonDock:DockingManager.LayoutItemContainerStyle>
                <Style TargetType="{x:Type avalonDock:LayoutItem}">
                    <Setter Property="Title" Value="{Binding Model.Content.DocumentViewModel.Title}" />
                    <Setter Property="ToolTip" Value="{Binding Model.Content.DocumentViewModel.Title}" />
                </Style>
            </avalonDock:DockingManager.LayoutItemContainerStyle>
            <infra:DocumentContextMenu.AdditionalContextMenuItems>
                <MenuItem Command="{Binding Model.Content.DocumentViewModel.OpenContainingFolderCommand}" Header="Open Containing Folder..." />
                <MenuItem Command="{Binding Model.Content.DocumentViewModel.CopyFullPathCommand}" Header="Copy Full Path" />
                <Separator />
            </infra:DocumentContextMenu.AdditionalContextMenuItems>
            <avalonDock:LayoutRoot>
                <avalonDock:LayoutPanel Orientation="Vertical">
                    <avalonDock:LayoutDocumentPane />
                </avalonDock:LayoutPanel>
            </avalonDock:LayoutRoot>
        </avalonDock:DockingManager>
    </Grid>
</metroControls:MetroWindow>
